package com.lvy.hczn.front.business.service;

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.ptr.IntByReference;

//public interface AccessService extends Library {
public interface AccessService {

    AccessService instance = (AccessService) Native.loadLibrary("\\home\\wms\\vbar", AccessService.class);

    /**
     * 打开设备
     *
     * @param type
     * @param param
     * @return
     * @author yw
     * @date 2022-11-10 16:03:07
     */
    IntByReference vbar_channel_open(int type, long param);

    /**
     * 向设备发送数据
     *
     * @param device
     * @param buffer
     * @param length
     * @return
     * @author yw
     * @date 2022-11-10 16:03:07
     */
    int vbar_channel_send(IntByReference device, byte[] buffer, int length);

    /**
     * 接收设备返回数据
     *
     * @param device
     * @param buffer
     * @param length
     * @param milliseconds
     * @return
     * @author yw
     * @date 2022-11-10 16:03:07
     */
    int vbar_channel_recv(IntByReference device, byte[] buffer, int length, int milliseconds);

    /**
     * 关闭设备传输通道
     *
     * @param device
     * @author yw
     * @date 2022-11-10 16:03:07
     */
    int vbar_channel_close(IntByReference device);
}
